import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

//* 格式化日期,yyyy-mm-dd
export function formatDate(date: Date) {
  return date.toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' });
}

//* 格式化时间,hh:mm
export function formatTime(date: Date) {
  return date.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' });
}

//* 格式化价格,单位:元
export function formatPrice(price: number) {
  return (price / 100).toFixed(2);
}
